from src.exts import db
from src.models.base_model import BaseModel


class Tag(BaseModel):
    """标签类"""
    __tablename__ = "tb_tag"

    id = db.Colunm(db.String(128), primary_key=True)
    name = db.Colunm(db.String(128), nullable=False, unique=True)

    def to_dict(self):
        model_dict = {
            "id": self.id,
            "name": self.name,
            "created": self.created,
            "updated": self.updated
        }

        return model_dict
